import java.io.File;
import java.io.IOException;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 86186
 * Date: 2023-10-04
 * Time: 16:34
 */
public class Test2 {
    public static void main(String[] args) throws IOException {
        File file = new File("d:/test.txt");
        System.out.println(file.exists());
        System.out.println(file.isDirectory());
        System.out.println(file.isFile());

        //如果文件创建成功则返回true，创建失败返回false
        boolean ret = file.createNewFile();
        System.out.println(ret);
        System.out.println(file.exists());
        System.out.println(file.isDirectory());
        System.out.println(file.isFile());

        //如果删除文件成功，则返回true，删除失败则返回false
        ret = file.delete();
        System.out.println(ret);
        System.out.println(file.exists());
    }
}
